package cn.edu.lzu.dao;

import cn.edu.lzu.entity.SupersonicExamineItem;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @PackageName: cn.edu.lzu.dao
 * @InterfaceName: SupersonicExamineItemMapper
 * @Description: TODO
 * @Author: 张琦[QQ:3098086691]
 * @Date: 2020/3/25 16:06
 * @Version: 1.0
 */
@Mapper
public interface SupersonicExamineItemMapper {
    @Select("select * from supersonic_examine_item where is_deleted=0 and unit_id=#{unitId} limit #{startIndex}, #{pageSize}")
    List<SupersonicExamineItem> selSupItemByUnitId(long unitId, int startIndex, int pageSize);

    @Select("select count(*) from supersonic_examine_item where is_deleted=0 and unit_id=#{unitId}")
    int selSupItemTotalCount(long unitId);

    @Insert("insert into supersonic_examine_item (examine_item_id, examine_name, examine_area, unit_type, apply_sex, apply_range, unit_id, price, is_deleted) values(default, #{examineName}, #{examineArea}, #{unitType}, #{applySex}, #{applyRange}, #{unitId}, #{price}, 0)")
    int insAddSupItem(SupersonicExamineItem supersonicExamineItem);

    @Update("update supersonic_examine_item set is_deleted=1 where examine_item_id=#{examineItemId}")
    int updDeleteSupItemById(int examineItemId);

    @Select("select * from supersonic_examine_item where is_deleted=0 and unit_id=#{unitId}")
    public List<SupersonicExamineItem> selAllSupExamineItem(long unitId);

    @Select("select * from supersonic_examine_item where is_deleted=0 and examine_item_id=#{examineItemId}")
    SupersonicExamineItem selByExamineItemId(int examineItemId);
}
